package com.aspose.cells;

public class PivotFilterCollection extends CollectionBase {
   PivotTable b;

   PivotFilterCollection(PivotTable table) {
      this.b = table;
   }

   public PivotFilter get(int index) {
      return (PivotFilter)this.a.get(index);
   }

   void a(PivotFilter var1) {
      com.aspose.cells.b.a.a.ze.a(this.a, (Object)var1);
   }

   public int add(int fieldIndex, int type) {
      if (fieldIndex >= 0 && fieldIndex < this.b.getBaseFields().getCount()) {
         this.clearFilter(fieldIndex);
         PivotFilter var3 = new PivotFilter(this.b.a.b);
         var3.a = fieldIndex;
         var3.b = type;
         com.aspose.cells.b.a.a.ze.a(this.a, (Object)var3);
         return this.a.size() - 1;
      } else {
         throw new CellsException(12, "This pivot field index is out of range");
      }
   }

   public void clearFilter(int fieldIndex) {
      if (fieldIndex >= 0 && fieldIndex < this.b.getBaseFields().getCount()) {
         for(int var2 = 0; var2 < this.getCount(); ++var2) {
            PivotFilter var3 = this.get(var2);
            if (var3.a == fieldIndex) {
               this.removeAt(var2);
            }
         }

      } else {
         throw new CellsException(12, "This pivot field index is out of range");
      }
   }

   void a(PivotFilterCollection var1) {
      this.a.clear();

      for(int var2 = 0; var2 < var1.getCount(); ++var2) {
         new PivotFilter(this.b.a.b);
         PivotFilter var3 = var1.get(var2);
         com.aspose.cells.b.a.a.ze.a(this.a, (Object)var3);
      }

   }
}
